﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VoiceAI;
using XiaoweiV2;

namespace XiaoweiVoiceAI
{
    internal static class ResponseCreator
    {
        private static readonly Dictionary<string, Func<XiaoweiVoiceAI, ResponseParam, IResponseData>> responseCreatorMap = new Dictionary<string, Func<XiaoweiVoiceAI, ResponseParam, IResponseData>>()
        {
            {Skills.Video,ResponseCreators.VideoResponseCreator. CreateResponseData},
            {Skills.Alarm,ResponseCreators.AlarmResponseCreator.CreateResponseData }, 
            {Skills.IotMasterDevice,ResponseCreators.IOTResponseCreator.CreateResponseData },
            {Skills.Lock,ResponseCreators.PCControlResponseCreatorForLockScreen.CreateResponseData },
            {Skills.Lock2,ResponseCreators.PCControlResponseCreatorForLockScreen.CreateResponseData },
            {Skills.Lock3,ResponseCreators.PCControlResponseCreatorForLockScreen.CreateResponseData },
            {Skills.Music,ResponseCreators.MusicResponseCreator.CreateResponseData },


            {Skills.News,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FM,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmHotProgram,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmTraProgram,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmNovel,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmStory,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmJoke,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmNews,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.WeixinTingShu,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.FmPingshu,ResponseCreators.RadioResponseCreator.CreateResponseData },



            {Skills.FmXiangsheng,ResponseCreators.RadioResponseCreator.CreateResponseData },
            {Skills.SettingPage,ResponseCreators.OpenAppResponseCreatorForSettingPage.CreateResponseData },
            {Skills.SettingPage2,ResponseCreators.OpenAppResponseCreatorForSettingPage2.CreateResponseData },
            {Skills.SettingPage3,ResponseCreators.OpenAppResponseCreatorForSettingPage.CreateResponseData },
            {Skills.Weather,ResponseCreators.WeatherResponseCreator.CreateResponseData },
            {Skills.GeneralControl,ResponseCreators.PCControlResponseCreator.CreateResponseData },
            {Skills.OpenAPP,ResponseCreators.OpenAppResponseCreator.CreateResponseData },
            {Skills.VideoFullScreen,ResponseCreators.VideoResponseCreatorForFullScreen.CreateResponseData},
            {Skills.VideoFullScreen2,ResponseCreators.VideoResponseCreatorForFullScreen.CreateResponseData},
            {Skills.GetDriverList, ResponseCreators.DriverListResponseCreator.CreateResponseData},
            {Skills.GetDriverList2, ResponseCreators.DriverListResponseCreator.CreateResponseData},
            {Skills.GetDriverList3, ResponseCreators.DriverListResponseCreator.CreateResponseData},
            {Skills.GetMaintainPosition, ResponseCreators.MaintainPositionResponseCreator.CreateResponseData},
            {Skills.GetMaintainPosition2, ResponseCreators.MaintainPositionResponseCreator.CreateResponseData},
            {Skills.GetMaintainPosition3, ResponseCreators.MaintainPositionResponseCreator.CreateResponseData},
            {Skills.SaleHelp, ResponseCreators.SaleHelpResponseCreator.CreateResponseData},
            {Skills.SaleHelp2,ResponseCreators.SaleHelpResponseCreator.CreateResponseData},
            {Skills.SaleHelp3, ResponseCreators.SaleHelpResponseCreator.CreateResponseData},
            {Skills.GetWarranty, ResponseCreators.WarrantyResponseCreator.CreateResponseData},
            {Skills.GetWarranty2, ResponseCreators.WarrantyResponseCreator.CreateResponseData}
        };
        public static IResponseData MakeResponseData(XiaoweiVoiceAI xiaoweiVoiceAI, ResponseParam param)
        {
            IResponseData responseData = null;
            if (responseCreatorMap.ContainsKey(param.Skill.Id))
            {
                responseData = responseCreatorMap[param.Skill.Id](xiaoweiVoiceAI, param);
            }
            if (responseData == null)
            {
                responseData = ResponseCreators.DefaultResponseCreator.CreateResponseData(xiaoweiVoiceAI, param);
            }
            return responseData;
        }
    }
}
